package xiong.myiot;

import android.content.ComponentName;
import android.content.ServiceConnection;
import android.os.IBinder;

public class MQTTServiceConnection implements ServiceConnection {

    private MQTTService mqttService;
    private MQTTGetMessageCallBack MQTTGetMessageCallBack;

    @Override
    public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
        mqttService = ((MQTTService.CustomBinder)iBinder).getService();
        mqttService.setMQTTGetMessageCallBack(MQTTGetMessageCallBack);
    }

    @Override
    public void onServiceDisconnected(ComponentName componentName) {

    }

    public MQTTService getMqttService(){
        return mqttService;
    }

    public void setIGetMessageCallBack(MQTTGetMessageCallBack MQTTGetMessageCallBack){
        this.MQTTGetMessageCallBack = MQTTGetMessageCallBack;
    }
}
